let handle;

window.onload = function() {
    debug.init_debug();
    debug.debug_msg_max_count = 10;
    debug.print("Debug Online!");
    debug.print("Here is test message:");
    debug.print("\tHello World!");

    new QWebChannel(qt.webChannelTransport, function(channel) {
        handle = channel.objects.handle;
        handle.DebugFunc.connect(function(message) {
            debug.print(message);
        });
    });

    let button = document.getElementById("click_me");
    button.onclick = function() {
        handle.SaySomething("Do Some Complex Work.");
    }
    let closeButton = document.getElementById("close");
    closeButton.onclick = function() {
        handle.CloseWindow();
    }
}